#!/usr/bin/env python3
import os
from launch import LaunchDescription
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory


def generate_launch_description():
    package_path = get_package_share_directory("path_planer")
    rviz__file = os.path.join(package_path, "config", "path_view.rviz")

    path_publisher_node = Node(
        package="path_planer",
        executable="path_publisher",
        name="path_publisher_node",
        parameters=[{"path_file": "database/pathes/path1.csv"}],
        output="screen",
    )

    path_creator_node = Node(
        package="path_planer",
        executable="path_creator",
        name="path_creator_node",
        output="screen",
    )

    rviz2_node = Node(
        package="rviz2",
        executable="rviz2",
        name="rviz2",
        output="screen",
        arguments=["-d", rviz__file],
    )

    return LaunchDescription(
        [
            path_publisher_node,
            # path_creator_node,
            rviz2_node,
        ]
    )
